package com.wt.wechatTools.tools;

import android.content.Context;
import android.view.View;

import androidx.appcompat.app.AlertDialog;


public class AlertDialogLoading {
    private AlertDialog alertDialog;
    private  View view;

    public AlertDialogLoading(Context context, View dialogView) {
        this.view = dialogView;
        this.alertDialog = new AlertDialog.Builder(context).create();
    }

    /**
     * 显示加载框
     */
    public void showLoadingDialog() {
        alertDialog.setCancelable(false);
//        alertDialog.setCanceledOnTouchOutside(false);
        alertDialog.setView(view);
        alertDialog.show();
    }

    /**
     * 关闭加载框
     */
    public void dismissLoadingDialog() {
        if (null != alertDialog && alertDialog.isShowing()) {
            alertDialog.dismiss();
        }
    }
}
